/*
 *  BM_CPU.h
 *  BM_CPU
 *
 *  Created by Mohammad H. Afrasiabi on 09-11-16.
 *  Copyright 2009 UBC. All rights reserved.
 *
 */

/*!
    @header bm
    @abstract   Boyer-Moore string search algorithm 
    @discussion For more information on Boyer-Moore please refere to : "http://www-igm.univ-mlv.fr/~lecroq/string/node14.html"
*/

#pragma once

#include "disp.h"

#define ADD_RESULT(__result) Disp_Add_Result(__result)

#define GSIZE 255
#define BSIZE 255

/*!
    @function
    @abstract   Initialize Boyer-Moore
    @discussion Initialize and precompute jump tables needed to be used by BM_Search() function
    @param      pattern Buffer to pattern string
	@param      patternSize Size of the pattern string
*/
void BM_Init(char *pattern, int patternSize);

/*!
	@function
	@abstract   Boyer-Moore string search
	@discussion Upon invokation function returns all the rusults by calling ADD_RESULT directive. 
	@param      pattern Buffer of pattern string
	@param      patternSize Size of the pattern string
	@param      text Buffer of text
	@param      textSize Size of text buffer
 */
void BM_Search(char *text, int textSize);
